
function OutputResults(k)

    addpath('helpers')
    
    basic_parameters;
    version = {'','_sh'};

    MARKETS             = [10000];
    M                   = length(models);
    Z                   = length(instruments);
    V                   = length(version);
    
    for v = 1:V
    vers = version{v};

    % targets of interest
    sim_results.mean_own_elasticity         = nan(M+1,numsims,Z);
    sim_results.models                      = models;
    sim_results.instruments                 = instruments;
    sim_results.dccs_L                      = nan(M+1,numsims,Z);
    sim_results.dccs_RCL                    = nan(M+1,numsims,Z);
    sim_results.dcsx_Lnom                   = nan(M+1,numsims,Z);
    sim_results.dcsx_L                      = nan(M+1,numsims,Z);
    sim_results.dcsx_RCL                    = nan(M+1,numsims,Z);

    for market = MARKETS
    for m = 1:M
    for z = 1:Z
    for i = 1:numsims
    
    fprintf('Current market value: %d\n', market);
    model = models{m};
    inst = instruments{z};
    
    % RESULTS
    file = ['../output/product/results/estimation_',inst,'_',model,'_k',int2str(k),'_s',int2str(i),'_m',int2str(market),vers,'.mat'];

    if isfile(file)
        try
            
        disp(['Loading data from model: ',model,', instrument: ',inst,', dgp: ',int2str(k),', seed: ',int2str(i), ', market: ',int2str(market), ','])
        
        load(file);
        
        mean_elast                  = mean(dresults.ownElas, 'omitnan');
        true_elast                  = mean(df_sim.dsdp_jt.*df_sim.p_jt./df_sim.s_jt);
            
        
                
        if isnan(sim_results.mean_own_elasticity(1,i,1))
            sim_results.mean_own_elasticity(1,i,:)     = true_elast;
        end 
            
        sim_results.mean_own_elasticity(1+m,i,z)        = mean_elast;

        if i == 1
            disp(['SIMRESULTS']);    
            sim_distance = load(sprintf('../output/product/data_generated/sim_data_sim%d_%d_%d%s.mat', k, i, market,vers));
            sim_results.dccs_L(1,i,z)                     = sim_distance.coefs_sim.dist_mis.dccs_L;
            sim_results.dccs_RCL(1,i,z)                   = sim_distance.coefs_sim.dist_mis.dccs_RCL;
            sim_results.dcsx_Lnom(1,i,z)                  = sim_distance.coefs_sim.dist_mis.dcsx_Lnom;
            sim_results.dcsx_L(1,i,z)                     = sim_distance.coefs_sim.dist_mis.dcsx_L;
            sim_results.dcsx_RCL(1,i,z)                   = sim_distance.coefs_sim.dist_mis.dcsx_RCL;
            disp(['SUCCESS!']);    
        end
        
        catch err
        
        disp(['Results with errors for model: ',model,', instrument: ',inst,', dgp: ',int2str(k),', iteration: ',int2str(i), ', market: ',int2str(market), '.'])
            
        end
    
    else
        
        disp(['Results not found for model: ',model,', instrument: ',inst,', dgp: ',int2str(k),', iteration: ',int2str(i), ', market: ',int2str(market), '.'])
        
    end

    end  % End of i-loop

        % SAVE OUTPUT        
        save(['../output/product/exports/sim_results_k',int2str(k),'_m',int2str(market),vers,'.mat'],'sim_results');

    end  % End of z-loop
    end  % End of m-loop
    end  % End of market-loop
    end  % End of v-loop
